# -*- coding:utf-8 -*-

import xlwt
import xlrd
from xlutils.copy import copy

header=['数字代号', '中文名', 'KEY', '拼音', '简称']

def writeExcel_first(contentList,filename):
    wb = xlwt.Workbook()
    ws = wb.add_sheet('overview')

    #print(len(header))

    for col in range(len(header)):
        ws.write(0,col,header[col])

    for row in range(len(contentList)):
        print("第" + str(row + 1) + "行的数据正在写入")
        ws.write(row + 1, 0, contentList[row].getCode())
        ws.write(row + 1, 1, contentList[row].getName())
        ws.write(row + 1, 2, contentList[row].getKey())
        ws.write(row + 1, 3, contentList[row].getPinyin())
        ws.write(row + 1, 4, contentList[row].getShortPinyin())
    # break
    wb.save(filename)
